package net.lesscoding.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lesscoding.entity.account.AccountTbl;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * @author eleven
 * @date 2025/4/16 14:18
 * @apiNote
 */
public interface AccountMapper extends BaseMapper<AccountTbl> {

    @Update("update account_tbl set money = money - #{money} where user_id = #{userId}")
    Integer deduct(String userId, BigDecimal money);

    @Update("update account_tbl set money = money + #{money} where user_id = #{userId}")
    Integer refund(@Param("userId")String userId, @Param("money")BigDecimal money);
}
